package service

import (
	log "github.com/sirupsen/logrus"
	"runtime"
)

type SwDeviceService interface {
	StartUsbBusControl(connId int64, sid int32) error
	StopUsbBusControl(connId int64) error
}

var SwDeviceServiceFactoryObj = &SwDeviceServiceFactory{}

type SwDeviceServiceFactory struct{}

func (f *SwDeviceServiceFactory) Create(clientSvc UsbIpClientCmdService) SwDeviceService {
	os := runtime.GOOS
	switch os {
	case "windows":
		log.Infof("当前是 Windows 系统")
		return NewSwDeviceWindowsServiceImpl(clientSvc)
	case "linux":
		log.Infof("当前是 Linux 系统")
		return NewSwDeviceLinuxServiceImpl()
	default:
		log.Infof("当前是其他系统：%s\n", os)
	}
	return nil
}
